

    var i = document.getElementById('ImgLoop1');
    //  首先开始自动播放图片
    var go = setInterval("NextSwitching()",2000);
    var left =document.getElementById("ChangeLeft");
    var right =document.getElementById("ChangeR");
//    光标进去图片图片暂停滚动
    i.addEventListener('mouseover', function () {
        clearInterval(go);
    });
//    光标移开图片自动轮播
    i.addEventListener('mouseout', function () {
        go = setInterval("NextSwitching()", 2000);
    })
    // 监听做切换按钮
    left.addEventListener('click',function () {
        clearInterval(go);
        PreviouSwitching();
        go = setInterval("NextSwitching()",2000);
    });
    // 监听右切换按钮
    right.addEventListener('click',function () {
        clearInterval(go);
        NextSwitching();
        go = setInterval("NextSwitching()",2000);
    });

//  切换后一张图片函数
    function NextSwitching() {
        var img_src = i.src;
        var img_char = img_src.charAt(img_src.length - 5);
        var img_number = img_char - '0';
        if (img_number == 5) img_number = 1;
        else img_number++;
        img_char = img_number + '';
        i.src = '../img-liJiajian/' + '左侧二级菜单' + img_char + '.jpg';
        color(Math.floor(Math.random() * 6));
    }

// 切换前一张图片函数
    function PreviouSwitching() {
        var img_src = i.src;
        var img_char = img_src.charAt(img_src.length - 5);
        var img_number = img_char - '0';
        if (img_number == 1) img_number = 5;
        else img_number--;
        img_char = img_number + '';
        i.src = '../img-liJiajian/' + '左侧二级菜单' + img_char + '.jpg';
        color(Math.floor(Math.random() * 6));
    }
